/*
 * Copyright 2014 Graham Smith
 */
package uk.co.wobblycogs.vegas;

import java.time.Duration;
import java.time.Instant;

/**
 *
 * @author Graham Smith
 */
public class VegasUtilities {

	private VegasUtilities() {
	}

	public static String formatDuration(Instant start, Instant end) {
		return formatDuration(Duration.between(start, end));
	}

	public static String formatDuration(Duration d) {
		long hours = d.toHours();
		long minutes = d.minusHours(hours).toMinutes();
		long seconds = d.minusHours(hours).minusMinutes(minutes).getSeconds();
		long milliseconds = d.getNano() / 1000000;
		String duration = "Scan duration: " + hours + " hours " + minutes + " minutes " + seconds + "." + milliseconds + " seconds";
		return duration;
	}

}
